package com.gosophia.resource.action;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseSupportAction;
import com.gosophia.commons.web.bean.RequestResult;
import com.gosophia.resourcePermission.dto.ResourcePermissionDTO;
import com.gosophia.resourcePermission.ws.ResourcePermissionWebService;
import com.gosophia.util.RequestResultUtil;

/**
 * 查询指定资源集
 * 
 * @author zhao_yanfang
 * 
 */
@Controller("findResourceByIdAction")
@Scope("prototype")
public class FindResourceByIdAction extends BaseSupportAction {

	private static final Log logger = LogFactory
			.getLog(ShowResourcePageAction.class);
	private long rid;
	private ResourcePermissionDTO resourcePermissionDTO;
	private String message;
	@Autowired
	private ResourcePermissionWebService resourcePermissionWebService;

	public String _execute() throws Exception {
		resourcePermissionDTO = resourcePermissionWebService
				.findResourceById(rid);
		logger.info("资源集规则为:" + resourcePermissionDTO.getRuleDtos().size());
		return SUCCESS;
	}

	public long getRid() {
		return rid;
	}

	public void setRid(long rid) {
		this.rid = rid;
	}

	public ResourcePermissionDTO getResourcePermissionDTO() {
		return resourcePermissionDTO;
	}

	public void setResourcePermissionDTO(
			ResourcePermissionDTO resourcePermissionDTO) {
		this.resourcePermissionDTO = resourcePermissionDTO;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

}
